<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="layui-fluid">

    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-card-header" style="color:#d02e25;font-family: '楷体'; ">
                流出申请
            </div>



        </div>
        <div class="layui-card-body">
            <table id="lchulist" lay-filter="lchulist"></table>
        </div>
    </div>


</div>





<script type="application/javascript"></script>

<script>
    layui.use(['table','form'], function(){
        var table = layui.table
            ,form = layui.form;

        //组织关系转接列表
        table.render({
            elem: '#lchulist'
            // ,height: 'full-200'
            ,method: 'post'
            ,url: '/ajax/party/admin/lchulist'
            ,page: true
            ,loading: true
            ,cellMinWidth: 80
            ,limit: 10
            ,id: 'lchulist'
            ,cols: [[
                {field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left'}
                ,{field: 'name', title: '姓名',edit:'text',width: 100}
                ,{field: 'sourceBranch', title: '原党组织',edit:'text'}
                ,{field: 'flowoutBranch', title: '流出党组织',edit:'text'}
                ,{field: 'type', title: '流动类型',edit:'text'}
                ,{fixed: 'right', title: '操作', align: 'center', width: 120, toolbar: '#dothing' }
            ]]
        });
        //监听工具条
        table.on('tool(lchulist)', function(obj){
            var data = obj.data;

            if(obj.event === 'detail'){

                $.post('/ajax/party/admin/getOneLchu',{
                    id:data.id
                },function(result){
                    layer.open({
                        type: 1,
                        area: ['800px','80%'],
                        title: "ID:" + data.id,
                        offset: '10%',
                        anim: 4,
                        shadeClose: true,
                        content: showdetails(result.data)
                    });
                    console.log(result);

                    });


            } else if(obj.event === 'del'){
                layer.confirm('真的删除行么', function(index){
                    $.post("/ajax/party/admin/delLiuchu",{
                        id:data.id
                    },function(result){
                        console.log(result);
                        if(result.code==0){
                            layer.alert("删除成功！");
                        }
                        obj.del();
                        layer.close(index);
                    });
                });
            }
        });





    });
</script>

<script>
    function showdetails(data) {
        var s = '<form class="layui-form" id="form1">\n' +
            '    <div class="layui-card">\n' +
            '\n' +
            '        <div class="layui-card-body">\n' +
            '            <div class="layui-form-item">\n' +
            '                <label class="layui-form-label">姓名</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="name" value='+ data.name +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">原组织</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="sourceBranch" value='+ data.sourceBranch +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '             </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '                <label class="layui-form-label">流出组织</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="flowoutBranch" value='+ data.flowoutBranch +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">流出党组织电话</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="flowoutTell" value='+ data.flowoutBranch +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '                <label class="layui-form-label">流出党组织联系人</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="flowoutBranch" value='+ data.flowoutBranch +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">流动原因</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="reason" value='+ data.reason +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '                <label class="layui-form-label">流动类别</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="type" value='+ data.type +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '                <label class="layui-form-label">原职业</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="sourceOccupation" value='+ data.sourceOccupation +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '                <label class="layui-form-label">申请时间</label>\n' +
            '                <div class="layui-input-inline">\n' +
            '                    <input type="text" name="updateTime" value='+ data.updateTime +' lay-verify="required"\n' +
            '                           autocomplete="off" class="layui-input">\n' +
            '                </div>\n' +
            '\n' +
            '            </div>\n' +
            '\n' +
            '            <div class="layui-form-item">\n' +
            '                <label class="layui-form-label">申请说明</label>\n' +
            '                <textarea name="pExplain"  lay-verify="required"placeholder="" class="layui-textarea">'+ data.pExplain +'</textarea>\n' +
            '            </div>\n' +
            '        </div>\n' +
            '    </div>\n' +
            '</form>';

        return s;
    }


</script>

<script type="text/html" id="dothing">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>

    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

